#import threading
import threading


class Account:
    def __init__(self):
        self.balance = 0

    def add(self,lock):
        lock.acquire()
        for i in range(0,100000):
            self.balance +=1
        lock.release()

    def delete(self,lock):
        lock.acquire()
        for i in range(0,100000):
            self.balance -=1
        lock.release()

if __name__=='__main__':
    account = Account()
    lock = threading.Lock()
    thread_add = threading.Thread(target=account.add,args=(lock,))
    thread_del = threading.Thread(target=account.delete,args=(lock,))
    thread_add.start()
    thread_del.start()
    thread_add.join()
    thread_del.join()

    print('The final balance is :{}'.format(account.balance))
